//
//  CategoryView.swift
//  MakeMoney
//
//  Created by Fan ZhiQiang on 2025/2/6.
//

import SwiftUI
import Charts

struct CategoryView: View {
    var data:[Categories] = [
        Categories(id: 0, num1: 1, num2: 20),
        Categories(id: 1, num1: 5, num2: 20),
        Categories(id: 2, num1: 23, num2: 20),
        Categories(id: 3, num1: 19, num2: 20),
        Categories(id: 4, num1: 17, num2: 20),
        Categories(id: 5, num1: 13, num2: 20),
        Categories(id: 6, num1: 15, num2: 20),
        Categories(id: 7, num1: 11, num2: 20),
        Categories(id: 8, num1: 21, num2: 20),
        Categories(id: 9, num1: 9, num2: 20),
        Categories(id: 10, num1: 7, num2: 20)
    ]
    
    var body: some View {
        Chart(data) { item in
            LineMark(x: .value("id", item.id), y: .value("num1", item.num1))
                .foregroundStyle(.cyan)
                .interpolationMethod(.cardinal)
                .symbol(.circle)
                
        }
//        .chartYAxis {
//            AxisMarks(values: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,26,28,29,30,31])
//        }
    }
}

#Preview {
    CategoryView()
}

struct Categories: Identifiable {
    var id: Int = 1
    var num1: Int = 0
    var num2: Int = 0
    
}


